/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package org.wxwp;

import java.util.Date;

/**
 * <p>Project: jse2302 - HashCodeDemo
 * <p>Powered by webrx On 2023-06-16 17:50:46
 * <p>Created by IntelliJ IDEA
 *
 * @author  webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class HashCodeDemo {


    public static void main(String[] args) {
        Book b1 = new Book(1,"java");
        Book b2 = new Book(1,"java");
        b1 = b2;

        System.out.println(b1==b2);
        System.out.println(b1.equals(b2));
        System.out.println(b1.hashCode());
        System.out.println(b2.hashCode());

        String str = "ok";
        System.out.println(str.hashCode());
        String s = "ok";
        System.out.println(s.hashCode());

        String s1 = new String("ok");
        String s2 = new String("ok");
        System.out.println(s1.hashCode());
        System.out.println(s2.hashCode());
        System.out.println(s1==s2);
        System.out.println(s1.equals(s2));

        Date d = new Date();
        System.out.println(d.hashCode());


    }
}
